Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YaDocs connector #80

Merged
merged 3 commits into from
Nov 10, 2023
Merged

Add YaDocs connector #80

merged 3 commits into from
Nov 10, 2023

Conversation

vallbull
Copy link
Contributor

@vallbull vallbull commented Nov 9, 2023

No description provided.

@vallbull vallbull force-pushed the new_connector_type_ya_docs branch from 53c7dc3 to 6aa51f2 Compare November 9, 2023 10:05
Comment on lines 11 to 17
NOTIF_TYPE_GSHEETS_V2_STALE_DATA = NotificationType.declare("stale_data")
NOTIF_TYPE_GSHEETS_V2_DATA_UPDATE_FAILURE = NotificationType.declare("data_update_failure")
NOTIF_TYPE_GSHEETS_V2_STALE_DATA = NOTIF_TYPE_STALE_DATA
NOTIF_TYPE_GSHEETS_V2_DATA_UPDATE_FAILURE = NOTIF_TYPE_DATA_UPDATE_FAILURE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these notifications are basically the same, I think there is no need to specify their copies with specific names. What I mean is, we can just use NOTIF_TYPE_STALE_DATA & NOTIF_TYPE_DATA_UPDATE_FAILURE where they are needed, without these assignments

)
from dl_connector_bundle_chs3.constants import NOTIF_TYPE_STALE_DATA, NOTIF_TYPE_DATA_UPDATE_FAILURE

CONNECTION_TYPE_YADOCS = ConnectionType.declare("yadocs")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed to just docs

from dl_connector_bundle_chs3.chs3_yadocs.core.us_connection import YaDocsFileS3Connection


class YaDocsFileS3ConnectionLifecycleManager(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember that we agreed not to create a lifecycle manager before we bother about data update
This cannot work at the moment because the only data update file-uploader-api is aware of is for gsheets
But ok, let's keep it

Comment on lines 12 to 19
class StaleDataNotification(BaseNotification):
type = NOTIF_TYPE_YADOCS_STALE_DATA
_title = "Stale data"
_message = "The data has not been updated for more than 30 minutes, a background update is in progress"
_level = NotificationLevel.info


class DataUpdateFailureNotification(BaseNotification):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for notification types
These notifications are pretty generic, I think we can just have them in chs3_base

@@ -12,5 +12,8 @@ msgstr ""
msgid "label_connector-gsheets_v2"
msgstr "Google Sheets"

msgid "label_connector-gsheets_v2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong id

@@ -160,10 +161,17 @@ def _make_id(self, field: converter_parsing_utils.TResultColumn) -> str:
return idx_to_alphabet_notation(field["index"]) # type: ignore # TODO: FIX


@attr.s
class YaDocsFieldIdGenerator(FileUploaderFieldIdGenerator):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss this a bit more later
We had to implement alphabet notation for gsheets_v2 to remain consistency with the old gsheets connector, I'm not ready to neither confirm or deny that we need it in YaDocs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it used anywhere?

@vallbull vallbull force-pushed the new_connector_type_ya_docs branch from 38bc2bc to 593a40a Compare November 10, 2023 10:58
NOTIF_TYPE_GSHEETS_V2_STALE_DATA,
from dl_connector_bundle_chs3.chs3_base.core.constants import (
NOTIF_TYPE_DATA_UPDATE_FAILURE,
NOTIF_TYPE_STALE_DATA,
)


class StaleDataNotification(BaseNotification):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too

@vallbull vallbull merged commit 8c87dda into main Nov 10, 2023
34 of 38 checks passed
@vallbull vallbull deleted the new_connector_type_ya_docs branch November 10, 2023 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants